package com.lpf.adapter;

// 适配器类，将 OldDataReader 的接口转换为 NewDataReader 接口
class DataAdapter implements NewDataReader {
    private OldDataReader oldDataReader;

    public DataAdapter(OldDataReader oldDataReader) {
        this.oldDataReader = oldDataReader;
    }

    @Override
    public String readNewFormatData() {
        // 调用老接口并进行数据转换
        String oldData = oldDataReader.readOldFormatData();
        return convertToNewFormat(oldData);
    }

    private String convertToNewFormat(String oldData) {
        // 数据转换逻辑
        return "Converted: " + oldData;
    }
}
